const Promise = require('./promise')
const promise = new Promise((resolve, reject)=>{
   setTimeout(()=>{
    resolve('吃饭了')
   },1000)
    // throw new Error('便秘') 
})
 const promise2 = promise.then((value)=>{
    console.log(value,'then')
    return new Promise((resolve , reject)=>{
        resolve(new Promise((resolve2,reject2)=>{
            resolve2('嵌套promise')
        }))
    })
})

promise2.then((value)=>{
    console.log(value)
    return 123
},(reason)=>{
  console.log(reason)
}).then((value)=>{
  console.log(value)
})
